﻿using System;

namespace Common
{
    public class DateAndTime
    {
        public enum TimeUnits
        {
            Seconds = 1,
            Minutes = 2,
            Hours = 3,
            Days = 4,
            Weeks = 5,
            Months = 6,
            Years = 7
        }
        public static int ConvertTimeUnit(TimeUnits timeUnit, int seconds, int minutes = 0, int hours = 0, int days = 0, int weeks = 0, int months = 0, int years = 0)
        {
            var conversion = 0;
            var conversionInSeconds = (Convert.ToInt32(hours) * 60 * 60) + (Convert.ToInt32(minutes) * 60) + (Convert.ToInt32(seconds));
            switch (timeUnit)
            {
                case TimeUnits.Seconds:
                    conversion = conversionInSeconds;
                    break;
                case TimeUnits.Minutes:
                    conversion = Convert.ToInt32(Math.Ceiling((double) conversionInSeconds/60));
                    break;
                case TimeUnits.Hours:
                    break;
            }
            return conversion;
        }
    }
}
